package utils

import (
	"bytes"
	"encoding/binary"
	"log"
)

// ---------------工具包------------

// int64整型数据转成16进制字符串
func IntToHex(num int64) []byte {
	buff := new(bytes.Buffer)
	err := binary.Write(buff, binary.BigEndian, num)
	if err != nil {
		log.Panic(err)
	}

	return buff.Bytes()
}

// 字符串反向
func ReverseBytes(data []byte)  {
	for i,j := 0, len(data)-1;i < j;i,j = i+1,j-1   {
		data[i],data[j] = data[j],data[i]
	}
}